<template>
  <div class="mymenu">
      <el-menu
      :default-active="$route.path"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      :collapse="sidebar.opened"
      >
      <router-link to='/'> 
         <el-menu-item index="/home">
          <i class="iconfont icon-home"></i>
          <span slot="title">首页</span>
        </el-menu-item>
      </router-link>
      <router-link to="/super" v-if="roleid == 1">
        <el-menu-item index="/super">
          <i class="iconfont icon-home"></i>
         <span slot="title">超级管理员</span>
        </el-menu-item>
      </router-link>
      <el-submenu index="1">
        <template slot="title">
          <!-- <i class="el-icon-location"></i> -->
          <span class="iconfont icon-shangpin-tianchong"></span>
          <span>商品</span>
        </template>
        <el-menu-item-group>
          <router-link to='/pms/product'>
          <el-menu-item index="/pms/product">
          <span class="iconfont icon-liebiao1"></span>
          商品列表
          </el-menu-item>
          </router-link>
          <router-link to='/pms/productadd'>
          <el-menu-item index="1-2"><span class="iconfont icon-tianjia"></span> 添加商品</el-menu-item>
          </router-link>
          <router-link to='/pms/productCate'>
          <el-menu-item index="1-3"><span class="iconfont icon-fenlei"></span> 商品分类</el-menu-item>
          </router-link>
          <router-link to='/pms/productAttr'>
          <el-menu-item index="1-4"><span class="iconfont icon-liebiao"></span> 商品类型</el-menu-item>
          </router-link>
          <router-link to='/pms/brand'>
          <el-menu-item index="1-5"><span class="iconfont icon-pinpaitemai"></span> 品牌管理</el-menu-item>
          </router-link>
        </el-menu-item-group>
        </el-submenu>
     
      <!-- <el-menu-item index="2">
        <i class="el-icon-menu"></i>
        <span slot="title">导航二</span>
      </el-menu-item>
      <el-menu-item index="3" disabled>
        <i class="el-icon-document"></i>
        <span slot="title">导航三</span>
      </el-menu-item>
      <el-menu-item index="4">
        <i class="el-icon-setting"></i>
        <span slot="title">导航四</span>
      </el-menu-item> -->
    </el-menu>

  </div>
</template>

<script>
 import { mapGetters } from "vuex";
export default {
  name: "sidebar",
  methods: {
    handleOpen() {
      console.log("打开菜单");
    },
    handleClose() {
      console.log("关闭菜单");
    },
  },
    computed: {
   ...mapGetters(["sidebar","roleid"]),
  },
};
</script>

<style scoped lang='scss'>
.mymenu {
  .el-menu {
    border-right: none;
  }
}
</style>